package com.jh.microservice.base;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {

        //SpringApplication.run(DemoApplication.class, args);

        SpringApplication springApplication = new SpringApplication(DemoApplication.class);
        Map<String, Object> propertiesMap = new HashMap<>(4);
        // 随机端口，方便测试
        propertiesMap.put("server.port", "0");
        springApplication.setDefaultProperties(propertiesMap);
        // 以非Web方式启动
        springApplication.setWebApplicationType(WebApplicationType.NONE);
        springApplication.run(args);


        /*new SpringApplicationBuilder(DemoApplication.class)
                .properties("server.port=8081")
                .run(args);*/
    }

}
